package a04_字符串;

/**
 * <p>
 * a01_反转字符串
 * </p>
 *
 * @author flyduck
 * @since 2024-07-09
 */
public class a01_反转字符串复习1 {
    public void reverseString(char[] source) {
        int leftIndex = 0;
        int rightIndex = source.length - 1;
        while (leftIndex < rightIndex) {
            char temp = source[leftIndex];
            source[leftIndex] = source[rightIndex];
            source[rightIndex] = temp;

            leftIndex++;
            rightIndex--;
        }
    }
}
